/**
 * Created by kaqu on 06/03/15.
 */
/**
 * http://createjs.com/tutorials/Mouse%20Interaction/ - TODO read this
 */
var stage;
var dragBox;
var dragContainer;

var graphicsDebugMode = true;

var hexPixelSize = [45, 52, 26];

//createjs.Ticker.addEventListener("tick", tick);

function init() {

    loadGraphics();
    stage = new createjs.Stage("gameCanvas");
    // The DragBox listens to mouse events.
    //dragBox = new createjs.Shape(new createjs.Graphics().beginFill("#ff0000").drawRect(0, 0, stage.canvas.width, stage.canvas.height));
    //dragBox.on("pressmove", drag);//.addEventListener("mousedown", startDrag);
    //stage.addChild(dragBox);
    //
    //// Container to drag around
    //dragContainer = new createjs.Container();
    //stage.addChild(dragContainer);
}

//Resize TODO - check with drag
function setGameScreenSize(width, height) {
    stage.canvas.width = width;
    stage.canvas.height = height;
    stage.update();
}

function drag(evt) {
    // target will be the container that the event listener was added to
    //if (evt.target.name == "square") {
    //    evt.target.x = evt.stageX - SIZE;
    //    evt.target.y = evt.stageY - SIZE;
    //}
    //else {
    //    evt.target.x = evt.stageX;
    //    evt.target.y = evt.stageY;
    //}

    dragContainer.regX =  evt.stageX;//evt.target.x;//event.stageX - offset.x;
    dragContainer.regY = evt.stageY;//evt.target.y; // event.stageY - offset.y;
    // make sure to redraw the stage to show the change
    stage.update();
}

